﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Model;

namespace IProfileDAL
{
    /// <summary>
    /// Interface for the Profile DAL
    /// </summary>
    public interface IiBookShopProfileProvider
    {
        /// <summary>
        /// Retrieve collection of shopping cart items
        /// </summary>
        /// <param name="userName">User Name</param>
        /// <param name="appName">Application Name</param>
        /// <returns>Collection of shopping cart items</returns>
        IList<CartItemInfo> GetCartItems(string userName, string appName);

        /// <summary>
        /// Update shopping cart for current user
        /// </summary>
        /// <param name="profileId">Profile Id</param>
        /// <param name="cartItems">Collection of shopping cart items</param>
        void SetCartItems(int profileId, ICollection<CartItemInfo> cartItems);

        /// <summary>
        /// Update activity dates for current user and application
        /// </summary>
        /// <param name="userName">User Name</param>
        /// <param name="appName">Application Name</param>
        void UpdateActivityDates(string userName, string appName);

        /// <summary>
        /// Retrive profile id for current user
        /// </summary>
        /// <param name="userName">User Name</param>
        /// <param name="isAuthenticated">Authentication flag</param>
        /// <param name="ignoreAuthenticationType">Ignore authentication flag</param>
        /// <param name="appName">Application Name</param>
        /// <returns>Profile Id for current user</returns>
        int GetProfileId(string userName, bool isAuthenticated, bool ignoreAuthenticationType, string appName);

        /// <summary>
        /// Create profile record for current user
        /// </summary>
        /// <param name="userName">User Name</param>
        /// <param name="isAuthenticated">Authentication flag</param>
        /// <param name="appName">Application Name</param>
        /// <returns>ProfileId</returns>
        int CreateProfileForUser(string userName, bool isAuthenticated, string appName);

        /// <summary>
        /// Retrieve collection of inactive users' profile ids
        /// </summary>
        /// <param name="authenticationOption">Authentication option</param>
        /// <param name="userInactiveSinceDate">Date to start searching from</param>
        /// <param name="appName">Application Name</param>
        /// <returns>Collection of inactive profile ids</returns>
        IList<string> GetInactiveProfiles(int authenticationOption, DateTime userInactiveSinceDate, string appName);

        /// <summary>
        /// Delete user's profile
        /// </summary>
        /// <param name="userName">User Name</param>
        /// <param name="appName">Application Name</param>
        /// <returns>True if it's successfully deleted</returns>
        bool DeleteProfile(string userName, string appName);

        /// <summary>
        ///  Retrieve profile information
        /// </summary>
        /// <param name="authenticationOption">Authentication option</param>
        /// <param name="usernameToMatch">User Name</param>
        /// <param name="userInactiveSinceDate">Date to start searching from</param>
        /// <param name="appName">Application Name</param>
        /// <param name="totalRecords">Number of records to return</param>
        /// <returns>Collection of profiles</returns>
        IList<UserProfileInfo> GetProfileInfo(int authenticationOption, string usernameToMatch, DateTime userInactiveSinceDate, string appName, out int totalRecords);
    }
}